package com.example.fan.airline_reservation.Model;

import java.util.Date;

import cn.bmob.v3.BmobObject;

public class Order extends BmobObject {
    /*旅行时间、旅行始发地和目的地*/
    /*（姓名、性别、工作单位、身份证号码（护照号码）*/
    /*因为数据库保存不了Passenger类的东西，所以用元素代替*/
    /*但是构造函数中已经完成从passenger类的转换，所以只需要传入passenger类*/
    private String pName;/*姓名*/
    private int pSex;/*性别*/
    private String pWorkName;/*工作地点*/
    private String pIdentityCard;/*身份证号码*/
    private String pTeleNum;/*手机号码*/

    private double price;/*机票成交价格*/
    private double date;/*出发日期*/
    private String fight;/*航班号*/
    private String account;/*下单账号*/
    private boolean ticketCollect=false;/*是否取票*/



    public Order(Passenger p, double price,Date date, String fight,String ID){
        setPassenger(p);
        setPrice(price);
        setDate(date);
        setFight(fight);
        setAccount(ID);
    }

    public Passenger getPassenger(){
        return new Passenger(pName,pSex,pWorkName,pIdentityCard,pTeleNum);
    }

    public void setPassenger(Passenger p){
        pName=p.getName();
        pSex=p.getSex();
        pWorkName=p.getWorkPlace();
        pIdentityCard=p.getIdentityCard();
        pTeleNum=p.getTeleNum();
    }

    public Date getDate() {
        Date d = new Date((long) date);
        return d;
    }

    public Order(){

    }
    public String getpName() {
        return pName;
    }

    public void setDate(Date date) {
        this.date = date.getTime();
    }

    public String getFight() {
        return fight;
    }

    public void setFight(String fight) {
        this.fight = fight;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public String getAccount() {
        return account;
    }

    public void setAccount(String account) {
        this.account = account;
    }

    public boolean isTicketCollect() {
        return ticketCollect;
    }

    public void setTicketCollect(boolean ticketCollect) {
        this.ticketCollect = ticketCollect;
    }


}
